
import './index.styl'
import router from 'umi/router'
import noImg from 'assets/no_Img.png'

function PendingCard({ data }){
    // 跳转详情页 
    const toDetail = () => {
        router.push({
            pathname:toWhere[data.procInsType],
            query: {
                id: data.businessId,
                orderId: data.businessId,
                procInsId: data.procInsId,
                listState: 1,
            },
        });
    }

    // 判断需要跳转的页面
    const toWhere = {
        '设备台账': '/deviceLedger/detail',
        '点检计划': '/deviceCheck/detail',
        '保养计划': '/deviceUpkeep/detail',
        '检定计划': '/deviceCali/detail',
        '维修任务': '/deviceRepair/RepairDetails',
    }

    return(
        <a href="javascript:viod(0)" onClick={toDetail}>
            <div className='pending-card'>
                <div className='img-box'>
                    <img src={data && data.createdUserImage ? data.createdUserImage : noImg} alt=''/>
                </div>
                <div className='pendingContent'>
                    <div className='content-box'>
                        <span className='title'>创建人：</span>
                        <span className='contentText'>{data && data.createdBy}</span>
                    </div>
                    <div className='content-box taskBox'>
                        <div className='taskTitle title'>任务名称：</div>
                        <div className='taskName contentText' style= {{marginBottom: 0}}>{data && data.procInsName}</div>
                    </div>
                    <div className='content-box'>
                        <span className='title'>任务类别：</span>
                        <span className='contentText'>{data && data.procInsType}</span>
                        <span className='auditBtn'>审批></span>
                    </div>
                </div>
                <div className='clickCard' ></div>
            </div>
        </a>
    )
}

export default PendingCard